<?php

namespace app\teacher\model;

use app\common\model\TeacherCourse as TeacherCourseModel;
use think\Model;

class TeacherCourse extends TeacherCourseModel
{

    /**
     * 新增
     */
    public function add(array $data)
    {
//        return $data;
        return $this->allowField(true)->save($data);
    }

    /**
     * 教师课程
     */
    public static function getColumnByTeacherId($teacherId, $column)
    {
        return self::where('teacher_id', $teacherId)->column($column);
    }

    public static function getTeacherCourseId($teacherId)
    {
        return self::where('teacher_id', $teacherId)->value('teacher_course_id');
    }

    public static function updateByTeacherId($teacherId, $data)
    {
        return self::where('teacher_id', $teacherId)->update($data);
    }
}
